<template>
  <div>
    <MyHeader title="购物车案例" color='' bgc='darkgreen'/>
    <div class="main">
    <MyGoods v-for="item in list" :key="item.id" :good="item"/>
    </div>
    <MyFooter :list='list'/>
  </div>
</template>

<script>
import MyHeader from './components/04-MyHeader'
import MyGoods from './components/04-MyGoods'
import MyFooter from './components/04-MyFooter'
export default {
  data(){
    return{
      list:[]
    }
  },
  components:{
    MyHeader,
    MyGoods,
    MyFooter
  },
  created(){
    this.$axios({
      url: "/api/cart"
    }).then(res =>{
      console.log(res);
      this.list = res.data.list
    }).catch(err =>{
      console.log(err);
    })
  }
}
</script>

<style>
.main{
    padding-top: 45px;
    padding-bottom: 50px;
  }
</style>